#ifndef DESIGNERCONTAINER_H
#define DESIGNERCONTAINER_H

#include <QWidget>
#include "Include/IEditor.h"

class QAbstractTableModel;
class StatusBar;
namespace Plugins
{
    class Designer;
    class Project;

    class DesignerContainer : public QWidget, public Plugins::IEditor
    {
        Q_OBJECT
        Q_INTERFACES(Plugins::IEditor)
    public:
        DesignerContainer(Designer *edit, QWidget *parent, Project * prj);
        virtual QWidget * widget();
        virtual QsciLexer * getLexer();
        virtual void setLexerByName(const QString& lexName);
        virtual bool save();
        virtual bool load(const QString & path);
        virtual void setText(const QString& text);
        virtual void setTheme(ITheme * theme = NULL, QFont * fnt = NULL);

        virtual void activate();
        virtual QString selectedText();
        virtual void find(const QString& find, bool forward);
        virtual void replace(const QString& find, const QString& replace, bool findNext, bool forward);
        virtual void replaceAll(const QString& find, const QString& replace);
        virtual bool isModified();
        virtual void setStatusBarVisible(bool show = true);
    signals:
        void copyAvailable(bool);
        void undoAvailable(bool);
        void redoAvailable(bool);
        void pasteAvailable(bool);
        void modifyChanged(bool);
        void closeEditor();
        void severityChanged(int);
        void errorListChanged(QAbstractTableModel*);
        void fileNavigate(const QString&, int);
    public slots:
        virtual void undo();
        virtual void redo();
        virtual void copy();
        virtual void cut();
        virtual void paste();
        virtual void del();
        virtual void selectAll();
        virtual void uppercase();
        virtual void lowercase();
        virtual void capitalize();
        virtual bool reset();
        virtual void jumpLine(int);
        virtual void jumpOffset(int);
    protected:
        virtual void focusInEvent(QFocusEvent *);
    private:
        Designer *_edit;
        StatusBar *_bar;
    };

}
#endif // DESIGNERCONTAINER_H
